package com.codefish.example.entity;

import com.codefish.framework.spring.beans.factory.IFactoryBean;
import lombok.Data;

import java.util.concurrent.ThreadLocalRandom;

/**
 * @author <a href='https://gitee.com/hzf2281'>codefish</a>
 * @version 1.0.0
 * @since 2022/10/08 下午 04:49
 */
@Data
public class MyRandom implements IFactoryBean<Integer> {

    private boolean singletonFlag = true;

    @Override
    public Integer getObject() {
        return ThreadLocalRandom.current().nextInt(50);
    }

    @Override
    public Class<?> getObjectType() {
        return Integer.class;
    }

    @Override
    public boolean isSingleton() {
        return singletonFlag;
    }

}
